package com.wry.es.config;

import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;

/**
 * <h1> ES配置 <h1>
 *
 * @author wry
 * @since 2023/4/7 15:50
 */
@Configuration
public class EsConfig {

    @Bean
    public RestHighLevelClient highLevelClient(){
        final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
                .connectedTo("localhost:9200")
                .build();
        return RestClients.create(clientConfiguration).rest();
    }
}
